package com.java.control.search;


/**
 * 分页
 * @author wjh
 * @version  Nov 22, 2011 9:03:37 AM
 */
public class SearchStat {
	/**
	 * 结果总数
	 */
	private Long totalCount = 0l;
	
	/**
	 * 获取查询条件（包括条件表达式和条件参数）
	 */
	private Long pageSize;
	
	public Long getPageSize() {
		if(pageSize == null || pageSize <= 0)
			return 0L;
		return pageSize;
	}
	public void setPageSize(Long pageSize) {
		this.pageSize = pageSize;
	}
	public Long getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(Long totalCount) {
		this.totalCount = totalCount;
	}
	
	/**
	 * 获取总页数
	 * @return
	 */
	public Long getPageCount() {
		if(pageSize==null || pageSize<=0 || totalCount == null || totalCount <= 0)
			return 0L;
		Long pageCount = totalCount / pageSize;
		pageCount += (totalCount % pageSize > 0) ? 1L : 0L;
		pageCount = pageCount>500 ? 500 : pageCount;
		return pageCount;
	}
	
}
